﻿CREATE TABLE [dbo].[Chitanta] (
    [IDChitanta]         INT              IDENTITY (1, 1) NOT NULL,
    [Numar]              VARCHAR (50)     NOT NULL,
    [Data]               DATETIME         NOT NULL,
    [IdPersoanaServiciu] INT              NOT NULL,
    [IdBeneficiar]       INT              NOT NULL,
    [ValoareTotala]      DECIMAL (18, 2)  NOT NULL,
    [CodUnitate]         SMALLINT         CONSTRAINT [DF_Chitanta_CodUnitate] DEFAULT ((0)) NOT NULL,
    [UserId]             UNIQUEIDENTIFIER NULL,
    CONSTRAINT [PK_Chitanta] PRIMARY KEY CLUSTERED ([IDChitanta] ASC),
    CONSTRAINT [FK_Chitanta_Beneficiar] FOREIGN KEY ([IdBeneficiar]) REFERENCES [dbo].[Beneficiar] ([IDBeneficiar]),
    CONSTRAINT [FK_Chitanta_Persoane] FOREIGN KEY ([IdPersoanaServiciu]) REFERENCES [dbo].[Persoane] ([IdPersoana]),
    CONSTRAINT [FK_Chitanta_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);

